﻿@if (Context.User.Identity.IsAuthenticated)
{
    <section class="col-lg-4 col-md-5 col-xs-12">
        <div class="esh-identity">
            <form asp-area="Identity" asp-page="/Account/Logout" method="post" id="logoutForm" class="navbar-right">
                <section class="esh-identity-section">
                    <div class="esh-identity-name">@Context.User.Identity.Name</div>
                    <img class="esh-identity-image" src="~/images/arrow-down.png">
                </section>
                <section class="esh-identity-drop">
                    @if (User.IsInRole("Administrators"))
                    {
                        <a class="esh-identity-item"
                           asp-page="/Admin/Index">
                            <div class="esh-identity-name esh-identity-name--upper">Admin</div>
                        </a>
                    }
                    <a class="esh-identity-item"
                       asp-controller="Order"
                       asp-action="MyOrders">
                        <div class="esh-identity-name esh-identity-name--upper">My orders</div>
                    </a>
                    <a class="esh-identity-item"
                       asp-controller="Manage"
                       asp-action="MyAccount">
                        <div class="esh-identity-name esh-identity-name--upper">My account</div>
                    </a>
                    <a class="esh-identity-item" href="javascript:document.getElementById('logoutForm').submit()">
                        <div class="esh-identity-name esh-identity-name--upper">Log Out</div>
                        <img class="esh-identity-image" src="~/images/logout.png">
                    </a>
                </section>
            </form>
        </div>
    </section>

    <section class="col-lg-1 col-xs-12">
        @await Component.InvokeAsync("Basket", User.Identity.Name)
    </section>

}
else
{
    <section class="col-lg-4 col-md-5 col-xs-12">
        <div class="esh-identity">
            <section class="esh-identity-section">
                <div class="esh-identity-item">

                    <a asp-area="Identity" asp-page="/Account/Login" class="esh-identity-name esh-identity-name--upper">
                        Login
                    </a>
                </div>
            </section>
        </div>
    </section>

    <section class="col-lg-1 col-xs-12">
        @await Component.InvokeAsync("Basket")
    </section>
}
